

<!doctype html>

<head>

	<!-- Basics -->
	
	<meta charset="utf-8">
	<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
	
	<title>携程数据管理平台</title>

	
<style type="text/css">

	@charset "utf-8";
/********rest.css start******* */
html,body,div,span,applet,object,iframe,h1,h2,h3,h4,h5,h6,p,blockquote,pre,a,abbr,acronym,address,big,cite,code,del,dfn,em,font,img,ins,kbd,q,s,samp,small,strike,strong,sub,sup,tt,var,b,u,i,center,dl,dt,dd,ol,ul,li,fieldset,form,label,legend,table,caption,tbody,tfoot,thead,tr,th,td{margin:0;padding:0;border:0;outline:0;font-size:100%;vertical-align:baseline;background:transparent}body{line-height:1;font:12px/1.5 tahoma,arial,'Hiragino Sans GB',\5b8b\4f53,sans-serif}ol,ul{list-style:none}blockquote,q{quotes:none}blockquote:before,blockquote:after,q:before,q:after{content:'';content:none}:focus{outline:0}ins{text-decoration:none}del{text-decoration:line-through}table{border-collapse:collapse;border-spacing:0}body{margin:0px;padding:0px;font-size:12px;line-height:1.8em;font-family:Verdana,Simsun,"Arial Unicode MS",Mingliu,Arial,Helvetica;color:#000}*{margin:0;padding:0}div,table,img,form{border:0}.clear{clear:both}ul,li,dl,dd,dt{list-style:none;padding:0;margin:0}p,div,table{margin:0px;padding:0px}h1,h2,h3,h4,h5,ul,P{margin:0px;padding:0px}h1,h2,h3,h4,h5{font-family:"Microsoft yahei";font-size:16px;line-height:24px;margin:0px;padding-top:0px;padding-right:0px;padding-bottom:0px;padding-left:0px}img{border:none}ul{list-style:none}a{color:#069;text-decoration:none}a:hover{color:#F30}.clearfloat{clear:both;height:0;font-size:1px;line-height:0px}font{font-size:9pt;line-height:1.8em;font-weight:normal}p{margin-top:0em;margin-bottom:1em}

.fl{ float:left}
.fr{ float:right}
body{ width: 747px; background: #fff}
.even,.estimate-form table tr:nth-of-type(even){background: #e8eff2}
.estimate-form table {
  line-height: 30px;
  width: 100%;
   table-layout:fixed;
   word-wrap: break-word; word-break: break-all;
}
.estimate-form table td {
  text-align: left;
  vertical-align: middle;
 padding: 2px 2px 2px 0px; 
}
.estimate-form table td.title{ padding-left: 5px; }
.estimate-form thead .left, #estimate-form tbody .left {
  text-align: left;
  padding-left: 15px;
  width: 260px;
}
input,select,textarea,button {
	width: 100%;
  font-size: 12px;
  line-height: 12px;
  padding: 3px 0px 3px 0px;
  border-top: 1px solid #999999;
  border-left: 1px solid #999999;
  border-right: 1px solid #eeeeee;
  border-bottom: 1px solid #eeeeee;
  border-radius: 3px;
  -webkit-border-radius: 3px;
  -moz-border-radius: 3px;
  -webkit-box-shadow: 1px 1px 1px rgba(0,0,0,.15) inset;
  -moz-box-shadow: 1px 1px 1px rgba(0,0,0,.15) inset;
  box-shadow: 1px 1px 1px rgba(0,0,0,.15) inset;
}
caption{background: #937754; color: #fff}
.btn-info {
  color: #fff;
  background-color: #5bc0de;
  border-color: #46b8da;
  width: 100px;
  height: 30px;
  margin-top: 10px;
  margin-bottom: 10px;cursor: pointer;
}
.btn-info:hover {
  padding: 5px;
  background: darkgreen;
  /* height: 40px; */
}
.estimate-form table td.has-error,.estimate-form table td.error{
	color: red
}
textarea{ font-size: 14px; line-height: 20px;}
em.info{  background: url("") no-repeat center center;
   width: 16px;
  height: 16px;
  display: inline-block;
  vertical-align: middle;
  /* float: right; */
  margin-left: 3px;cursor: pointer;}
  .abs{  position: absolute;
  top: 0px;
  left: 0px;
  width: auto;
  /* height: 16px; */
  line-height: 18px;
  padding: 3px 0px 3px 5px;
  background: #484848;
  color: #fff;
  border-radius: 5px;
  max-width: 250px;
  word-wrap: break-word; display: none
}
em.important{ display: inline-block;color: red; margin-right: 10px; font-weight: bold;}
.tip{ color: red; margin-left: 20px;}
input.error,textarea.error {
  border-color: rgb(204, 0, 0);
  border-color: #E82300;
  outline: 0;
  -webkit-box-shadow: inset 0 1px 1px rgba(0,0,0,0.075),0 0 8px #E82300;
  box-shadow: inset 0 1px 1px rgba(0,0,0,0.075),0 0 8px #E82300;
}
.abc{ color: #999999}
</style>
	
</head>

	<!-- Main HTML -->
	
<body>
	
	<!-- Begin Page Content -->
	<form id="hiveform" name="hiveform" class='estimate-form'>
		<div id="table">
		</div>

	

		  <div id="foot"><button type="button" class="btn btn-info" id="secure">生成脚本</button><span class="tip">提示：需要拷贝生成的代码到编辑器中</span></div>
	</form><!--/ container-->
	<textarea id="response" class="form-control" rows="20" cols="5"></textarea>
	<div class="abs" id="abs"></div>
	<!-- End Page Content -->
	
</body>

</html>
<script src="js/jquery-1.9.1.min.js" type="text/javascript"></script>

<script type="text/html" id="hiveFormSrc">
	<table class='form'>
		<thead>
			<td width="14.2587%" class='title'></td><td width="20.8095%"></td>
			<td width="28.5714%" class='title'></td><td width="33.3333%"></td>
		</thead>
		<caption>源</caption>
		<tbody>

			<tr>
				<td class='title' colspan="2">源（【sqlserver|mysql】）</td><td  colspan="2"><select class="form-control" name="src" id="src">
														  <option value="sqlserver">sqlserver</option>
														  <option value="mysql">mysql</option>
														  <option value="hive">hive</option>
													  </select></td><td></td><td></td>
			</tr>		
			<tr>
				<td class='title'>源数据库名<em class="important">*</em></td><td><input type="text" id="srcdb" name='srcdb'></td>
				<td class='title'>源数据库表名（逗号分隔）<em class="important">*</em></td><td><input type="text" id="srctblnames" name='srctblnames'></td>
			</tr>
			<tr>
				<td class='title'  width="70px"  colspan="1">源sql查询</td><td  colspan="3"  width="100px"><textarea id="querys" name='querys' rows="5" cols="5"></textarea></td>
				
			</tr>
			<tr>
				<td class='title'>querysplit</td><td><input type="text" id="querysplit" name='querysplit'></td>
				<td colspan="2" id="error_response"></td>
			</tr>

			
								
		</tbody>
	</table>
</script>
<script type="text/html" id="hiveFormTar">	
	<table class='form'>
			<thead>
				<td width="14.2587%" class='title'></td><td width="20.8095%"></td>
				<td width="28.5714%" class='title'></td><td width="33.3333%"></td>
			</thead>
			<caption>目标</caption>
			<tr>
				<td class='title'>目标</td><td><select class="form-control" name="tar" id="tar">
									  <option value="sqlserver">sqlserver</option>
									  <option value="mysql">mysql</option>
									  <option value="hive">hive</option>
									</select></td><td></td><td></td>
			</tr>
			<tr>
				<td class='title'>目标数据库名<em class="important">*</em></td><td><input type="text" id="tardb" name='tardb'></td>
				<td class='title'>目标数据库表名（逗号分隔）<em class="important">*</em></td><td><input type="text" id="tartblnames" name='tartblnames'></td>
			</tr>
			<tr>
				<td class='title' colspan="2">hive导入模式</td><td colspan="2"><select class="form-control" name="loadtype" id="loadtype">
											  <option value="1">全量不分区</option>
											  <option value="2">全量一级分区</option>
											  <option value="3">增量一级分区</option>
											  <option value="4">增量二级分区</option>
											  <option value="5">追加文件到hive表</option>
											  <option value="6">写文件到HDFS</option>
											</select></td>
				
			</tr>	
			<tr>
				<td class='title' style="display:none">pks<em class="info" data-title="源表主键，多个主键以英文逗号（,）作为分隔符"></em><em class="important">*</em></td><td style="display:none"><input type="text" id="pks" name='pks'></td>
				<td class='title' style="display:none">datenow<em class="info" data-title="指定将数据落到hive目标表的哪个时间分区，不指定默认为当天。只指定datepre的值，datenow默认取datepre的后一天"></em><em class="important">*</em></td><td style="display:none"><input type="text" id="datenow" name='datenow'></td>		
			</tr>
			<tr>
				<td class='title' style="display:none">datepre<em class="info" data-title="为本次增量任务做之前的全量的时间分区，与源增量表做比较操作，默认为datenow的前一天。只指定datenow的值，datepre默认取datenow的前一天"></em><em class="important">*</em></td><td style="display:none"><input type="text" id="datepre" name='datepre'></td>
				<td class='title' style="display:none">parttime<em class="info" data-title="源表时间字段，作为二级分区的参考字段substr(partime,0,10)，增量一级分区方案不用指定"></em><em class="important">*</em></td><td style="display:none"><input type="text" id="parttime" name='parttime'></td>		
			</tr>
			<tr>
				<td class='title' style="display:none">Fieldsplit<em class="info" data-title="写到hdfs的分隔符，默认’\t’，可选'\001' 已改成自动判断分隔符。(loadtype为6的时候需要指定)"></em><em class="important">*</em></td><td style="display:none"><input type="text" id="Fieldsplit" name='Fieldsplit' value="\001 \t"></td>
				<td class='title' style="display:none">hdfsdir<em class="important">*</em></td><td style="display:none"><input type="text" id="hdfsdir" name='hdfsdir'></td>		
			</tr
			<tr>
				<td class='title'  width="120px">hive文件类型</td><td  width="140px"><select class="form-control" name="filetype" id="filetype">
											  <option value="TXT">TXT</option>
											  <option value="SEQ">SEQ</option>
											  <option value="TXT_COMP">TXT_COMP</option>
											  <option value="SEQ_COMP">SEQ_COMP</option>
											  <option value="RCF">RCF</option>
											  <option value="RCF_COMP">RCF_COMP</option>
											</select></td>
				<td class='title'>任务并发数</td><td><input type="text" id="concurrency" name='concurrency' value=3></td>
			</tr>
			<tr>
				<td class='title' colspan="2" style="display:none">hive文件压缩编码类</td><td colspan="2" style="display:none"> <select class="form-control" name="codecclass" id="codecclass">
			  <option value="org.apache.hadoop.io.compress.BZip2Codec">org.apache.hadoop.io.compress.BZip2Codec</option>
			  <option value="org.apache.hadoop.io.compress.DefaultCodec">org.apache.hadoop.io.compress.DefaultCodec</option>
			  <option value="org.apache.hadoop.io.compress.GzipCodec">org.apache.hadoop.io.compress.GzipCodec</option>
			  <option value="org.apache.hadoop.io.compress.SnappyCodec ">org.apache.hadoop.io.compress.SnappyCodec </option>
			</select></td>
			</tr>
	</table>
</script>
<script type="text/html" id="normalFormSrc">
	<table class='form'>
		<thead>
				<td width="14.2587%" class='title'></td><td width="20.8095%"></td>
				<td width="28.5714%" class='title'></td><td width="33.3333%"></td>
		</thead>
		<caption>源</caption>
		<tbody>
			<tr>
				<td class='title' colspan="2">源（【sqlserver|mysql】）</td><td  colspan="2"><select class="form-control" name="src" id="src">
														  <option value="sqlserver">sqlserver</option>
														  <option value="mysql">mysql</option>
														  <option value="hive">hive</option>
													  </select></td><td></td><td></td>
			</tr>		
			<tr>
				<td width="60px" class='title'>源数据库域名<em class="important">*</em></td><td width="100px"><input type="text" id="srcip" name='srcip' placeholder="请填写域名，不要使用IP"></td>
				<td width="120px" class='title'>源数据库端口<em class="important">*</em></td><td width="140px"><input type="text" id="srcport" name='srcport'></td>
			</tr>
			<tr>
				<td class='title'>源数据库名<em class="important">*</em></td><td><input type="text" id="srcdb" name='srcdb'></td>
				<td class='title'>源数据库用户名<em class="important">*</em></td><td><input type="text" id="srcusername" name='srcusername'></td>
			</tr>
			<tr>
				<td class='title'>源数据库密码<em class="important">*</em></td><td><input type="text" id="srcpasswd" name='srcpasswd'></td>
				<td class='title'>源数据库表名（逗号分隔）<em class="important">*</em></td><td><input type="text" id="srctblnames" name='srctblnames'></td>
			</tr>
			<tr>
				<td class='title'  width="70px"  colspan="1">源sql查询</td><td  colspan="3"  width="100px"><textarea id="querys" name='querys' rows="5" cols="5"></textarea></td>
				
			</tr>
			<tr>
				<td class='title'>querysplit<em class='info' data-title='querys参数可能包含分号，配置querysplit参数，指定不包含在sql里的分隔符，即可排除。如-querysplit "#"'></em></td><td><input type="text" id="querysplit" name='querysplit'></td>
				<td colspan="2" id="error_response"></td>
			</tr>					
		</tbody>
	</table>
</script>
<script type="text/html" id="normalFormTar">
	<table class='form'>
			<thead>
				<td width="14.2587%" class='title'></td><td width="20.8095%"></td>
				<td width="28.5714%" class='title'></td><td width="33.3333%"></td>
			</thead>
			<caption>目标</caption>
			<tr>
				<td class='title'>目标</td><td><select class="form-control" name="tar" id="tar">
									  <option value="sqlserver">sqlserver</option>
									  <option value="mysql">mysql</option>
									  <option value="hive">hive</option>
									</select></td><td></td><td></td>
			</tr>	
			<tr>
				<td class='title'>目标数据库域名<em class="important">*</em></td><td><input type="text" id="tarip" name='tarip' placeholder="请填写域名，不要使用IP"></td>
				<td class='title'>目标数据库端口<em class="important">*</em></td><td><input type="text" id="tarport" name='tarport'></td>
			</tr>
			<tr>
				<td class='title'>目标数据库名<em class="important">*</em></td><td><input type="text" id="tardb" name='tardb'></td>
				<td class='title'>目标数据库用户名<em class="important">*</em></td><td><input type="text" id="tarusername" name='tarusername'></td>
			</tr>	
			<tr>
				<td class='title'>目标数据库密码<em class="important">*</em></td><td><input type="text" id="tarpasswd" name='tarpasswd'></td>
				<td class='title'>目标数据库表名（逗号分隔）<em class="important">*</em></td><td><input type="text" id="tartblnames" name='tartblnames'></td>
			</tr>
			<tr>
				<td class='title' colspan="2">插入数据库前SQL</td><td colspan="2"><input type="text" id="tarpresqls" name='tarpresqls'></td>
			</tr>
			<tr>
				<td class='title' colspan="2">插入数据库后SQL</td><td colspan="2"><input type="text" id="tarpostsqls" name='tarpostsqls'></td>
			</tr>
			<tr>
				<td class='title' colspan="2">目标表的字段名称</td><td colspan="2"><input type="text" id="tarcolorders" name='tarcolorders'></td>
			</tr>
			<tr>
				<td class='title' colspan="2" style="display:none">mysqlmethodtype([jdbc|infile|jdbc_replace])</td><td colspan="2" style="display:none"><select class="form-control" name="mysqlmethodtype" id="mysqlmethodtype">
									  <option value="jdbc">jdbc</option>
									  <option value="infile">infile</option>
									  <option value="jdbc_replace">jdbc_replace</option>
									</select></td>
			</tr>
			<tr>
				<td class='title'>任务并发数</td><td><input type="text" id="concurrency" name='concurrency' value=3></td>
				<td class='title'>forcecut(true|false)</td><td><select class="form-control" name="forcecut" id="forcecut">
									  <option value="true">true</option>
									  <option value="false" selected>false</option>
									</select></td>
			</tr>
	</table>
</script>
<script type="text/javascript">
var ISIE = !!document.all;
var HUANHANG="\r\n";
if(ISIE){
	HUANHANG="\n";
}
function validate(event){
		this.hiveHiddenInput = ["srcip","srcport","srcusername","srcpasswd"];
}
validate.countSpecifiedChar = function(string,char){
	return string.split(char).length -1;
}
validate.prototype={
	getForm : function(proto){
		return document.hiveform[proto];
	},
	getSrcTableCount : function(val){
		if(val.lastIndexOf(",") == val.length-1){//,在最后
			val = val.substring(0,val.length-1);
		}
		return val.split(",").length;
	},
	rules:{
		"querys":function(val,target){
			var querysCount = validate.countSpecifiedChar(val,";");
			var srctblnames = this.getForm('srctblnames');
			var srctblnamesCount = this.getSrcTableCount(srctblnames.value);
			if(querysCount > srctblnamesCount){
				target.addClass('error');
				$("#error_response").addClass('error').html("请使用querysplit参数");
				//console.log("请使用querysplit参数");
			}else{
				target.removeClass('error');
				$("#error_response").removeClass('error').html("");
			}
		},
		"srctblnames":function(val,target){
			var srctblnamesCount = this.getSrcTableCount(val);
			var querysnames = this.getForm('querys');
			var querysCount = validate.countSpecifiedChar(querysnames.value,";");
			if(querysCount > srctblnamesCount){
				target.addClass('error');
				$("#error_response").addClass('error').html("请使用querysplit参数");
				//console.log("请使用querysplit参数");
			}else{
				target.removeClass('error');
				$("#error_response").removeClass('error').html("");

			}
		},
		"srcip":function(val,target){
			if(!/[a-zA-Z]/.test(val)){
				target.addClass('error');
			}else{
				target.removeClass('error');
			}
		},
		"tarip":function(val,target){
			if(!/[a-zA-Z]/.test(val)){
				target.addClass('error');
			}else{
				target.removeClass('error');
			}
		},
		"src" : function(val,target){
			var self = this;
			switch(val){
				case 'sqlserver':
					self.Form.reset();
				break;
				case 'mysql':
					self.Form.reset();
					
				break;
				case 'hive':
					self.Form.reset();
				break;
			}
		},
		"tar" : function(val,target){
			var self = this;
			switch(val){
				case 'sqlserver':
					self.Form.reset();
				break;
				case 'mysql':
					self.Form.reset();
					self.Form.show("mysqlmethodtype");
				break;
				case 'hive':
					self.Form.reset();
				break;
			}
		},
		"loadtype":function(val,target){
			var self = this;
			switch(val){
				case '1':
					self.Form.hide(["datenow","pks","datepre","parttime","Fieldsplit","hdfsdir"]);
				break;
				case '2':
					self.Form.show("datenow").hide(["pks","datepre","parttime","Fieldsplit","hdfsdir"]);
				break;
				case '3':
					self.Form.show(["pks","datenow","datepre"]).hide(["Fieldsplit","parttime","hdfsdir"]);
				break;
				case '4':
					self.Form.show(["pks","parttime","datenow","datepre"]).hide(["Fieldsplit","hdfsdir"]);
				break;
				case '5':
					self.Form.hide(["datenow","pks","datepre","parttime","Fieldsplit","hdfsdir"]);
				break;
				case '6':
					self.Form.show(["Fieldsplit","hdfsdir"]).hide(["pks","parttime","datenow","datepre"]);
				break;
			}
		},
		"filetype":function(val,target){
			var self = this;
			switch(val){
				case 'TXT_COMP':
				case 'SEQ_COMP':
				case 'RCF_COMP':
					self.Form.show("codecclass");
				break;
				default:
					self.Form.hide("codecclass");
				break;
			}
		}
	},
	check:function(event){
			var target =$(event.target),reg=target.attr("data-reg"),val = target.val(),id=target.attr("id");
			if(reg){
				this.checkReg(reg,target);
		    }else if(this.rules.hasOwnProperty(id)){
		    	this.rules[id].call(this,val,target);	
		    }
	},
	checkReg:function(reg,target){
			var status=true;
			switch(reg){
				case 'email':
				if(!/^([a-zA-Z0-9]+[_|\_|\.]?)*[a-zA-Z0-9]+@([a-zA-Z0-9]+[_|\_|\.]?)*[a-zA-Z0-9]+\.[a-zA-Z]{2,3}$/.test(val)){
					status = false;
				}
				break;
				case 'noempty':
				if(val=='' || /^\s+$/.test(val)){
					status = false;
				}
				break;
				case 'number':
				if(val=='' || !/^\d+$/.test(val)){
					status = false;
				}
				break;
	    	}
		    if(!status){
		    	target.removeClass('has-success').addClass('has-error');
		    }else{
		    	target.removeClass('has-error').addClass('has-success');
		    }
	},
	PlaceHolder : {
		    _support: (function() {
		        return 'placeholder' in document.createElement('input');
		    })(),
		 
		    //提示文字的样式，需要在页面中其他位置定义
		    className: 'abc',
		 
		    init: function() {
		        if (!this._support) {
		            //未对textarea处理，需要的自己加上
		            var inputs = $('input[placeholder]');
		            this._setValue(inputs);
		            this.create(inputs);
		        }
		    },
		 
		    create: function(inputs) {

		        inputs.each(function(index,item){
		       		$(item).on('focus',function(event){
		       			var target = $(event.target);
		       			if(target.val() == target.attr('placeholder')){
		       				target.val('').removeClass('abc');
		       			}
		       		});
		       		$(item).on('blur',function(event){
		       			var target = $(event.target);
		       			setTimeout(function(){//针对wdatepicker 做了延迟处理 防止纠错提示
			       			if(target.val() == ''){
			       				target.val(target.attr('placeholder')).addClass('abc');
			       			}
			       		},100);
		       		});
		        });
		    },
		 
		    _setValue: function(input) {
		       input.each(function(index,item){
		       		$(item).val($(item).attr("placeholder")).addClass('abc');
		       });
		    
		    }
	}

}

var Form = function(){
	(this.data  || (this.data={}))['tar']='hive';
	this.setTemplate();

	this.table = $("#table");
	this.form = document.hiveform;
	this.init();
	this.bindEvent();
	this.validateInstance = new validate();
	this.validateInstance.Form = this;
	this.validateInstance.PlaceHolder.init();
}

Form.prototype.init = function(){
	this.table.html(document.getElementById(this.htmlTemplateSrc).innerHTML+document.getElementById(this.htmlTemplateTar).innerHTML);
	if(this.data){
		for(var i in this.data){
			
			this.form[i] && (this.form[i].value = this.data[i]);
		}
	}
	return this;
}
Form.prototype.reset = function(){
	this.serialize().setTemplate().init();
	return this;
}
Form.prototype.show = function(ele){
	var self = this;
	if(Object.prototype.toString.call(ele)=='[object Array]'){
		ele.forEach(function(elem){
			self.show(elem);
		});
	}else{
		var element = $(this.form[ele]).parent();
		element.show();
		element.prev().show();
	}
	return this;
}	
Form.prototype.hide = function(ele){
	var self = this;
	if(Object.prototype.toString.call(ele)=='[object Array]'){
		ele.forEach(function(elem){
			self.hide(elem);
		});
	}else{
		var element = $(this.form[ele]).parent();
		element.hide();
		element.prev().hide();
	}
	return this;
}					
Form.prototype.setTemplate = function(){
	this.htmlTemplateSrc = this.data && this.data.src=='hive' ? "hiveFormSrc":"normalFormSrc";
	this.htmlTemplateTar = this.data && this.data.tar=='hive' ? "hiveFormTar":"normalFormTar";
	return this;
}
Form.prototype.serialize = function() {
    var parts = {},form =this.form;
    var field = null;
    for (var i = 0,
    len = form.elements.length; i < len; i++) {
        field = form.elements[i];
        switch (field.type) {
        case "select-one":
        case "select-multiple":
            for (var j = 0,
            optLen = field.options.length; j < optLen; j++) {
                var option = field.options[j];
                if (option.selected) {
                    var optValue = "";
                    if (option.hasAttribute) {
                        optValue = (option.hasAttribute("value") ? option.value: option.text)
                    } else {
                        optValue = (option.attributes["value"].specified ? option.value: option.text)
                    };
                    parts[field.name] =optValue;// encodeURIComponent(optValue)
                }
            };
            break;
        case undefined:
        case "file":
        case "submit":
        case "reset":
        case "button":
        case "fieldset":
            break;
        case "radio":
        case "checkbox":
            if (!field.checked) {
                break
            };
        default:
            //if (field.type === 'text' && field.value === '') break;
        	if (field.name === '') break;
        	if(ISIE && field.className=='abc')break;
            parts[field.name] = field.value;// != '' ? encodeURIComponent(field.value) : 1
        }
    };
    this.data = parts;
    return this;
}

Form.prototype.getShell = function(){
	var str = "sh datax_run.sh \\"+HUANHANG;
	var index = 1,contiueFlag=false;
	for(var key in this.data){
		if($(this.form[key]).parent().css("display")=='none')continue;
		if(key=='mysqlmethodtype' && this.data[key]=='jdbc'){
			continue;
		}else if(key=='concurrency' && this.data[key]==3){
			continue;
		}else if(key=='forcecut' && this.data[key]=='false'){
			continue;
		}else if(key=='filetype' && this.data[key]=='TXT'){
			continue;
		}else if(key=='querys'){
			str+=" \\"+HUANHANG+"-"+key+" \""+this.data[key]+"\" ";
			str+=" \\"+HUANHANG;
			index = 1;
			continue;
		}
		str+="-"+key+" "+this.data[key]+" ";
		if(index%2==0){
			str+=" \\"+HUANHANG;
		}
		index++;
	}
	return str;
}
Form.prototype.bindEvent = function(){
	var self = this;
	$("#secure").click(function(){
		if($("#error_response").hasClass("error")){
			alert("请检查错误");
			return;
		}
		self.serialize();
		var str = self.getShell();
		//console.log(str);
		$("#response").html(str);
	});
	$("#table").on('input propertychange',"input,textarea",function(event){
        self.validateInstance.check(event);
    });
    $("#table").on('change',"select",function(event){
        	self.validateInstance.check(event);
    });
    
    var abs= $("#abs");
    $("#table").on('mouseover',"em.info",function(event){
    	event.preventDefault();
    	abs.html($(this).attr("data-title"));
    	abs.css({"left":event.pageX+8,"top":event.pageY+8}).show();
    });
    $("#table").on('mouseout',"em.info",function(event){
    	event.preventDefault();
    	abs.hide();
    });
	return this;
}
var formInstance = new Form();  
</script>